{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"e159dba962a842e6bdcd087b59b7002e\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_e159dba962a842e6bdcd087b59b7002e = echarts.init(\n",
       "                    document.getElementById('e159dba962a842e6bdcd087b59b7002e'), 'white', {renderer: 'canvas'});\n",
       "                var option_e159dba962a842e6bdcd087b59b7002e = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5317\\u4eac\\u5e02\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbol\": \"rect\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"2000y\",\n",
       "                    3161.66\n",
       "                ],\n",
       "                [\n",
       "                    \"2001y\",\n",
       "                    3707.96\n",
       "                ],\n",
       "                [\n",
       "                    \"2002y\",\n",
       "                    4315.0\n",
       "                ],\n",
       "                [\n",
       "                    \"2003y\",\n",
       "                    5007.21\n",
       "                ],\n",
       "                [\n",
       "                    \"2004y\",\n",
       "                    6033.21\n",
       "                ],\n",
       "                [\n",
       "                    \"2005y\",\n",
       "                    6969.52\n",
       "                ],\n",
       "                [\n",
       "                    \"2006y\",\n",
       "                    8117.78\n",
       "                ],\n",
       "                [\n",
       "                    \"2007y\",\n",
       "                    9846.81\n",
       "                ],\n",
       "                [\n",
       "                    \"2008y\",\n",
       "                    11115.0\n",
       "                ],\n",
       "                [\n",
       "                    \"2009y\",\n",
       "                    12153.03\n",
       "                ],\n",
       "                [\n",
       "                    \"2010y\",\n",
       "                    14113.58\n",
       "                ],\n",
       "                [\n",
       "                    \"2011y\",\n",
       "                    16251.93\n",
       "                ],\n",
       "                [\n",
       "                    \"2012y\",\n",
       "                    17879.4\n",
       "                ],\n",
       "                [\n",
       "                    \"2013y\",\n",
       "                    19800.81\n",
       "                ],\n",
       "                [\n",
       "                    \"2014y\",\n",
       "                    21330.83\n",
       "                ],\n",
       "                [\n",
       "                    \"2015y\",\n",
       "                    23014.59\n",
       "                ],\n",
       "                [\n",
       "                    \"2016y\",\n",
       "                    25669.13\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0,\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u4e0a\\u6d77\\u5e02\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbol\": \"roundRect\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"2000y\",\n",
       "                    4771.17\n",
       "                ],\n",
       "                [\n",
       "                    \"2001y\",\n",
       "                    5210.12\n",
       "                ],\n",
       "                [\n",
       "                    \"2002y\",\n",
       "                    5741.03\n",
       "                ],\n",
       "                [\n",
       "                    \"2003y\",\n",
       "                    6694.23\n",
       "                ],\n",
       "                [\n",
       "                    \"2004y\",\n",
       "                    8072.83\n",
       "                ],\n",
       "                [\n",
       "                    \"2005y\",\n",
       "                    9247.66\n",
       "                ],\n",
       "                [\n",
       "                    \"2006y\",\n",
       "                    10572.24\n",
       "                ],\n",
       "                [\n",
       "                    \"2007y\",\n",
       "                    12494.01\n",
       "                ],\n",
       "                [\n",
       "                    \"2008y\",\n",
       "                    14069.86\n",
       "                ],\n",
       "                [\n",
       "                    \"2009y\",\n",
       "                    15046.45\n",
       "                ],\n",
       "                [\n",
       "                    \"2010y\",\n",
       "                    17165.98\n",
       "                ],\n",
       "                [\n",
       "                    \"2011y\",\n",
       "                    19195.69\n",
       "                ],\n",
       "                [\n",
       "                    \"2012y\",\n",
       "                    20181.72\n",
       "                ],\n",
       "                [\n",
       "                    \"2013y\",\n",
       "                    21818.15\n",
       "                ],\n",
       "                [\n",
       "                    \"2014y\",\n",
       "                    23567.7\n",
       "                ],\n",
       "                [\n",
       "                    \"2015y\",\n",
       "                    25123.45\n",
       "                ],\n",
       "                [\n",
       "                    \"2016y\",\n",
       "                    28178.65\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0,\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u6c5f\\u82cf\\u7701\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbol\": \"triangle\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"2000y\",\n",
       "                    8553.69\n",
       "                ],\n",
       "                [\n",
       "                    \"2001y\",\n",
       "                    9456.84\n",
       "                ],\n",
       "                [\n",
       "                    \"2002y\",\n",
       "                    10606.85\n",
       "                ],\n",
       "                [\n",
       "                    \"2003y\",\n",
       "                    12442.87\n",
       "                ],\n",
       "                [\n",
       "                    \"2004y\",\n",
       "                    15003.6\n",
       "                ],\n",
       "                [\n",
       "                    \"2005y\",\n",
       "                    18598.69\n",
       "                ],\n",
       "                [\n",
       "                    \"2006y\",\n",
       "                    21742.05\n",
       "                ],\n",
       "                [\n",
       "                    \"2007y\",\n",
       "                    26018.48\n",
       "                ],\n",
       "                [\n",
       "                    \"2008y\",\n",
       "                    30981.98\n",
       "                ],\n",
       "                [\n",
       "                    \"2009y\",\n",
       "                    34457.3\n",
       "                ],\n",
       "                [\n",
       "                    \"2010y\",\n",
       "                    41425.48\n",
       "                ],\n",
       "                [\n",
       "                    \"2011y\",\n",
       "                    49110.27\n",
       "                ],\n",
       "                [\n",
       "                    \"2012y\",\n",
       "                    54058.22\n",
       "                ],\n",
       "                [\n",
       "                    \"2013y\",\n",
       "                    59753.37\n",
       "                ],\n",
       "                [\n",
       "                    \"2014y\",\n",
       "                    65088.32\n",
       "                ],\n",
       "                [\n",
       "                    \"2015y\",\n",
       "                    70116.38\n",
       "                ],\n",
       "                [\n",
       "                    \"2016y\",\n",
       "                    77388.28\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0,\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5e7f\\u4e1c\\u7701\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbol\": \"diamond\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"2000y\",\n",
       "                    10741.25\n",
       "                ],\n",
       "                [\n",
       "                    \"2001y\",\n",
       "                    12039.25\n",
       "                ],\n",
       "                [\n",
       "                    \"2002y\",\n",
       "                    13502.42\n",
       "                ],\n",
       "                [\n",
       "                    \"2003y\",\n",
       "                    15844.64\n",
       "                ],\n",
       "                [\n",
       "                    \"2004y\",\n",
       "                    18864.62\n",
       "                ],\n",
       "                [\n",
       "                    \"2005y\",\n",
       "                    22557.37\n",
       "                ],\n",
       "                [\n",
       "                    \"2006y\",\n",
       "                    26587.76\n",
       "                ],\n",
       "                [\n",
       "                    \"2007y\",\n",
       "                    31777.01\n",
       "                ],\n",
       "                [\n",
       "                    \"2008y\",\n",
       "                    36796.71\n",
       "                ],\n",
       "                [\n",
       "                    \"2009y\",\n",
       "                    39482.56\n",
       "                ],\n",
       "                [\n",
       "                    \"2010y\",\n",
       "                    46013.06\n",
       "                ],\n",
       "                [\n",
       "                    \"2011y\",\n",
       "                    53210.28\n",
       "                ],\n",
       "                [\n",
       "                    \"2012y\",\n",
       "                    57067.92\n",
       "                ],\n",
       "                [\n",
       "                    \"2013y\",\n",
       "                    62474.79\n",
       "                ],\n",
       "                [\n",
       "                    \"2014y\",\n",
       "                    67809.85\n",
       "                ],\n",
       "                [\n",
       "                    \"2015y\",\n",
       "                    72812.55\n",
       "                ],\n",
       "                [\n",
       "                    \"2016y\",\n",
       "                    80854.91\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0,\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u798f\\u5efa\\u7701\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbol\": \"arrow\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"2000y\",\n",
       "                    3764.54\n",
       "                ],\n",
       "                [\n",
       "                    \"2001y\",\n",
       "                    4072.85\n",
       "                ],\n",
       "                [\n",
       "                    \"2002y\",\n",
       "                    4467.55\n",
       "                ],\n",
       "                [\n",
       "                    \"2003y\",\n",
       "                    4983.67\n",
       "                ],\n",
       "                [\n",
       "                    \"2004y\",\n",
       "                    5763.35\n",
       "                ],\n",
       "                [\n",
       "                    \"2005y\",\n",
       "                    6554.69\n",
       "                ],\n",
       "                [\n",
       "                    \"2006y\",\n",
       "                    7583.85\n",
       "                ],\n",
       "                [\n",
       "                    \"2007y\",\n",
       "                    9248.53\n",
       "                ],\n",
       "                [\n",
       "                    \"2008y\",\n",
       "                    10823.01\n",
       "                ],\n",
       "                [\n",
       "                    \"2009y\",\n",
       "                    12236.53\n",
       "                ],\n",
       "                [\n",
       "                    \"2010y\",\n",
       "                    14737.12\n",
       "                ],\n",
       "                [\n",
       "                    \"2011y\",\n",
       "                    17560.18\n",
       "                ],\n",
       "                [\n",
       "                    \"2012y\",\n",
       "                    19701.78\n",
       "                ],\n",
       "                [\n",
       "                    \"2013y\",\n",
       "                    21868.49\n",
       "                ],\n",
       "                [\n",
       "                    \"2014y\",\n",
       "                    24055.76\n",
       "                ],\n",
       "                [\n",
       "                    \"2015y\",\n",
       "                    25979.82\n",
       "                ],\n",
       "                [\n",
       "                    \"2016y\",\n",
       "                    28810.58\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0,\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5317\\u4eac\\u5e02\",\n",
       "                \"\\u4e0a\\u6d77\\u5e02\",\n",
       "                \"\\u6c5f\\u82cf\\u7701\",\n",
       "                \"\\u5e7f\\u4e1c\\u7701\",\n",
       "                \"\\u798f\\u5efa\\u7701\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5317\\u4eac\\u5e02\": true,\n",
       "                \"\\u4e0a\\u6d77\\u5e02\": true,\n",
       "                \"\\u6c5f\\u82cf\\u7701\": true,\n",
       "                \"\\u5e7f\\u4e1c\\u7701\": true,\n",
       "                \"\\u798f\\u5efa\\u7701\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"2000y\",\n",
       "                \"2001y\",\n",
       "                \"2002y\",\n",
       "                \"2003y\",\n",
       "                \"2004y\",\n",
       "                \"2005y\",\n",
       "                \"2006y\",\n",
       "                \"2007y\",\n",
       "                \"2008y\",\n",
       "                \"2009y\",\n",
       "                \"2010y\",\n",
       "                \"2011y\",\n",
       "                \"2012y\",\n",
       "                \"2013y\",\n",
       "                \"2014y\",\n",
       "                \"2015y\",\n",
       "                \"2016y\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"type\": \"log\",\n",
       "            \"show\": true,\n",
       "            \"scale\": true,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_e159dba962a842e6bdcd087b59b7002e.setOption(option_e159dba962a842e6bdcd087b59b7002e);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x20791a8e9d0>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#实验四.1\n",
    "from pyecharts.charts import Line#从pyecharts中导入line类\n",
    "from pyecharts import options as opts#使用 options 配置项\n",
    "from pyecharts.globals import CurrentConfig\n",
    "import pandas as pd\n",
    "\n",
    "\n",
    "df = pd.read_csv(r\"C:\\Users\\dell\\Desktop\\实验 四、五、六\\gdp.csv\")\n",
    "df = df.iloc[[0,8,9,18,12], 0:18].set_index(\"province\")\n",
    "\n",
    "symbols = [\"rect\", \"roundRect\", \"triangle\",\"diamond\",\"arrow\"]\n",
    "\n",
    "\n",
    "def show_line(df):\n",
    "    df_sort = df.T.sort_index() #\n",
    "    line = (\n",
    "            Line()\n",
    "            .add_xaxis( df_sort.index.tolist())\n",
    "\n",
    "            )\n",
    "    i = 0\n",
    "    for col in df_sort.columns:\n",
    "        line.add_yaxis(col, eval(repr(df_sort[col].values.tolist())),\n",
    "            symbol= symbols[i],\n",
    "            symbol_size= 10)\n",
    "            \n",
    "        i += 1\n",
    "    line.set_global_opts(yaxis_opts=opts.AxisOpts(\n",
    "        type_=\"log\",\n",
    "        is_scale=True,\n",
    "                        )\n",
    "        )\n",
    "    line.set_series_opts(label_opts = opts.LabelOpts(is_show=False))\n",
    "    return line\n",
    "\n",
    "show_line(df).render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"2b768d2731764a43bfe5a708bd9681de\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_2b768d2731764a43bfe5a708bd9681de = echarts.init(\n",
       "                    document.getElementById('2b768d2731764a43bfe5a708bd9681de'), 'white', {renderer: 'canvas'});\n",
       "                var option_2b768d2731764a43bfe5a708bd9681de = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u7cfb\\u52171\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": false,\n",
       "            \"smooth\": true,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"stack\": \"1\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u8349\\u8393\",\n",
       "                    95\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u8292\\u679c\",\n",
       "                    50\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u8461\\u8404\",\n",
       "                    81\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u96ea\\u68a8\",\n",
       "                    93\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u897f\\u74dc\",\n",
       "                    86\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u67e0\\u6aac\",\n",
       "                    129\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u8f66\\u5398\\u5b50\",\n",
       "                    59\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 1\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0,\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u7cfb\\u52172\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": false,\n",
       "            \"smooth\": true,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"stack\": \"1\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u8349\\u8393\",\n",
       "                    41\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u8292\\u679c\",\n",
       "                    139\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u8461\\u8404\",\n",
       "                    119\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u96ea\\u68a8\",\n",
       "                    31\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u897f\\u74dc\",\n",
       "                    78\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u67e0\\u6aac\",\n",
       "                    141\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u8f66\\u5398\\u5b50\",\n",
       "                    48\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 1\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0,\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u7cfb\\u52171\",\n",
       "                \"\\u7cfb\\u52172\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u7cfb\\u52171\": true,\n",
       "                \"\\u7cfb\\u52172\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"boundaryGap\": false,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u8349\\u8393\",\n",
       "                \"\\u8292\\u679c\",\n",
       "                \"\\u8461\\u8404\",\n",
       "                \"\\u96ea\\u68a8\",\n",
       "                \"\\u897f\\u74dc\",\n",
       "                \"\\u67e0\\u6aac\",\n",
       "                \"\\u8f66\\u5398\\u5b50\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u5806\\u53e0\\u6cb3\\u6d41\\u6548\\u679c\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_2b768d2731764a43bfe5a708bd9681de.setOption(option_2b768d2731764a43bfe5a708bd9681de);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x20791a8e1f0>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#实验四.2\n",
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Line, Page\n",
    "from pyecharts.faker import Collector, Faker\n",
    "def river() -> Line:\n",
    "    c = (\n",
    "        Line()\n",
    "        .add_xaxis(Faker.choose())\n",
    "        .add_yaxis(\"系列1\", Faker.values(), is_smooth=True, stack=\"1\", is_symbol_show=False)\n",
    "        .add_yaxis(\"系列2\", Faker.values(), is_smooth=True, stack=\"1\", is_symbol_show=False)\n",
    "        .set_series_opts(\n",
    "            areastyle_opts=opts.AreaStyleOpts(opacity=1),\n",
    "        )\n",
    "        .set_global_opts(\n",
    "            title_opts=opts.TitleOpts(title=\"堆叠河流效果\"),\n",
    "            xaxis_opts=opts.AxisOpts( boundary_gap=False ),\n",
    "        )\n",
    "    )\n",
    "    return c\n",
    "\n",
    "river().render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"5fb7f109961740978f8695d00324f464\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_5fb7f109961740978f8695d00324f464 = echarts.init(\n",
       "                    document.getElementById('5fb7f109961740978f8695d00324f464'), 'white', {renderer: 'canvas'});\n",
       "                var option_5fb7f109961740978f8695d00324f464 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"radar\",\n",
       "            \"name\": \"\\u8a79\\u59c6\\u65af-\\u54c8\\u767b\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    6.6,\n",
       "                    36.1,\n",
       "                    7.5,\n",
       "                    2.0,\n",
       "                    0.7\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"itemStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"color\": \"blue\"\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0.3\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"radar\",\n",
       "            \"name\": \"\\u4fdd\\u7f57-\\u4e54\\u6cbb\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    8.2,\n",
       "                    28.0,\n",
       "                    4.1,\n",
       "                    2.2,\n",
       "                    0.4\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"itemStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"color\": \"red\"\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0.3\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"radar\",\n",
       "            \"name\": \"\\u4e54\\u5c14-\\u6069\\u6bd4\\u5fb7\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    13.6,\n",
       "                    27.5,\n",
       "                    3.7,\n",
       "                    0.7,\n",
       "                    1.9\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"itemStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"color\": \"green\"\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0.3\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u8a79\\u59c6\\u65af-\\u54c8\\u767b\",\n",
       "                \"\\u4fdd\\u7f57-\\u4e54\\u6cbb\",\n",
       "                \"\\u4e54\\u5c14-\\u6069\\u6bd4\\u5fb7\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u8a79\\u59c6\\u65af-\\u54c8\\u767b\": true,\n",
       "                \"\\u4fdd\\u7f57-\\u4e54\\u6cbb\": true,\n",
       "                \"\\u4e54\\u5c14-\\u6069\\u6bd4\\u5fb7\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"radar\": {\n",
       "        \"indicator\": [\n",
       "            {\n",
       "                \"name\": \"\\u7bee\\u677f\",\n",
       "                \"max\": 15.6,\n",
       "                \"min\": 2.2\n",
       "            },\n",
       "            {\n",
       "                \"name\": \"\\u5f97\\u5206\",\n",
       "                \"max\": 36.1,\n",
       "                \"min\": 10.8\n",
       "            },\n",
       "            {\n",
       "                \"name\": \"\\u52a9\\u653b\",\n",
       "                \"max\": 10.7,\n",
       "                \"min\": 1.0\n",
       "            },\n",
       "            {\n",
       "                \"name\": \"\\u62a2\\u65ad\",\n",
       "                \"max\": 2.2,\n",
       "                \"min\": 0.4\n",
       "            },\n",
       "            {\n",
       "                \"name\": \"\\u76d6\\u5e3d\",\n",
       "                \"max\": 2.7,\n",
       "                \"min\": 0.0\n",
       "            }\n",
       "        ],\n",
       "        \"name\": {\n",
       "            \"textStyle\": {}\n",
       "        },\n",
       "        \"splitLine\": {\n",
       "            \"show\": true,\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            }\n",
       "        },\n",
       "        \"splitArea\": {\n",
       "            \"show\": true,\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        },\n",
       "        \"axisLine\": {\n",
       "            \"show\": true,\n",
       "            \"onZero\": true,\n",
       "            \"onZeroAxisIndex\": 0\n",
       "        }\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"NBA\\u4e09\\u4e2a\\u7b2c\\u4e00\\u4eba\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_5fb7f109961740978f8695d00324f464.setOption(option_5fb7f109961740978f8695d00324f464);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x20791a82700>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#实验五\n",
    "import pandas as pd\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Page, Radar\n",
    "from pyecharts.globals import CurrentConfig\n",
    "\n",
    "\n",
    "df = pd.read_csv(r\"C:\\Users\\dell\\Desktop\\实验 四、五、六\\nba.csv\")\n",
    "\n",
    "df_1 = df[(df['时间'] >=24 ) & (df['出场']>=50)]\n",
    "stats = [\"篮板\",\"得分\",\"助攻\",\"抢断\",\"盖帽\"]\n",
    "color_list = [ \"blue\",\"red\", \"green\",  \"#b4e0f3\", \"#1c3fbf\",\"#ffffff\"]\n",
    "c_schema = [\n",
    "    {\"name\": x, \"max\": df_1.max()[x], \"min\": df_1.min()[x]}  for x in stats\n",
    "    ]\n",
    "\n",
    "top1s = df.groupby(by='位置').head(1).set_index('球员')\n",
    "players = top1s.index.tolist()\n",
    "c = (\n",
    "    Radar()\n",
    "    .add_schema(\n",
    "      c_schema\n",
    "    )\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"NBA三个第一人\"),\n",
    "                     )\n",
    "\n",
    ")\n",
    "i=0\n",
    "for player,color in zip(players, color_list):\n",
    "    c.add(player, \n",
    "          eval(repr([ top1s.loc[player, stats].values.tolist()  ] )) ,\n",
    "          areastyle_opts=opts.AreaStyleOpts(opacity=0.3),\n",
    "          color = color,\n",
    "          )\n",
    "    i+=1\n",
    "        \n",
    "c.set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "c.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"d4e7e1da74f048079b897a1143a11410\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_d4e7e1da74f048079b897a1143a11410 = echarts.init(\n",
       "                    document.getElementById('d4e7e1da74f048079b897a1143a11410'), 'white', {renderer: 'canvas'});\n",
       "                var option_d4e7e1da74f048079b897a1143a11410 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"name\": \"\\u524d\\u950b\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    8.2,\n",
       "                    4.1,\n",
       "                    28.0,\n",
       "                    \"\\u4fdd\\u7f57-\\u4e54\\u6cbb\"\n",
       "                ],\n",
       "                [\n",
       "                    12.5,\n",
       "                    5.9,\n",
       "                    27.7,\n",
       "                    \"\\u626c\\u5c3c\\u65af-\\u963f\\u5fb7\\u6258\\u6606\\u535a\"\n",
       "                ],\n",
       "                [\n",
       "                    8.5,\n",
       "                    8.3,\n",
       "                    27.4,\n",
       "                    \"\\u52d2\\u5e03\\u6717-\\u8a79\\u59c6\\u65af\"\n",
       "                ],\n",
       "                [\n",
       "                    7.3,\n",
       "                    3.3,\n",
       "                    26.6,\n",
       "                    \"\\u79d1\\u6000-\\u4f26\\u7eb3\\u5fb7\"\n",
       "                ],\n",
       "                [\n",
       "                    6.4,\n",
       "                    5.9,\n",
       "                    26.0,\n",
       "                    \"\\u51ef\\u6587-\\u675c\\u5170\\u7279\"\n",
       "                ],\n",
       "                [\n",
       "                    12.0,\n",
       "                    3.9,\n",
       "                    25.9,\n",
       "                    \"\\u5b89\\u4e1c\\u5c3c-\\u6234\\u7ef4\\u65af\"\n",
       "                ],\n",
       "                [\n",
       "                    7.5,\n",
       "                    5.4,\n",
       "                    24.5,\n",
       "                    \"\\u5e03\\u96f7\\u514b-\\u683c\\u91cc\\u82ac\"\n",
       "                ],\n",
       "                [\n",
       "                    8.7,\n",
       "                    3.1,\n",
       "                    21.4,\n",
       "                    \"\\u6731\\u5229\\u53f6\\u65af-\\u5170\\u5fb7\\u5c14\"\n",
       "                ],\n",
       "                [\n",
       "                    9.2,\n",
       "                    2.4,\n",
       "                    21.3,\n",
       "                    \"\\u62c9\\u739b\\u5e93\\u65af-\\u963f\\u5c14\\u5fb7\\u91cc\\u5947\"\n",
       "                ],\n",
       "                [\n",
       "                    12.0,\n",
       "                    3.8,\n",
       "                    20.8,\n",
       "                    \"\\u5c3c\\u53e4\\u62c9-\\u6b66\\u5207\\u7ef4\\u5947\"\n",
       "                ],\n",
       "                [\n",
       "                    7.9,\n",
       "                    2.8,\n",
       "                    20.0,\n",
       "                    \"\\u6258\\u6bd4\\u4e9a\\u65af-\\u54c8\\u91cc\\u65af\"\n",
       "                ],\n",
       "                [\n",
       "                    8.0,\n",
       "                    1.0,\n",
       "                    20.0,\n",
       "                    \"\\u96c5\\u5361\\u5c14-\\u6851\\u666e\\u68ee\"\n",
       "                ],\n",
       "                [\n",
       "                    6.1,\n",
       "                    2.6,\n",
       "                    19.8,\n",
       "                    \"\\u8fbe\\u5c3c\\u7f57-\\u52a0\\u91cc\\u7eb3\\u5229\"\n",
       "                ],\n",
       "                [\n",
       "                    9.8,\n",
       "                    2.0,\n",
       "                    19.5,\n",
       "                    \"\\u7ea6\\u7ff0-\\u79d1\\u6797\\u65af\"\n",
       "                ],\n",
       "                [\n",
       "                    9.0,\n",
       "                    1.4,\n",
       "                    18.7,\n",
       "                    \"\\u52b3\\u91cc-\\u9a6c\\u5c14\\u5361\\u5b81\"\n",
       "                ],\n",
       "                [\n",
       "                    5.3,\n",
       "                    4.0,\n",
       "                    18.7,\n",
       "                    \"\\u5409\\u7c73-\\u5df4\\u7279\\u52d2\"\n",
       "                ],\n",
       "                [\n",
       "                    5.5,\n",
       "                    2.5,\n",
       "                    18.7,\n",
       "                    \"\\u51ef\\u5c14-\\u5e93\\u5179\\u9a6c\"\n",
       "                ],\n",
       "                [\n",
       "                    6.0,\n",
       "                    4.3,\n",
       "                    18.3,\n",
       "                    \"\\u514b\\u91cc\\u65af-\\u7c73\\u5fb7\\u5c14\\u987f\"\n",
       "                ],\n",
       "                [\n",
       "                    5.1,\n",
       "                    3.0,\n",
       "                    18.3,\n",
       "                    \"\\u5e03\\u5170\\u987f-\\u82f1\\u683c\\u62c9\\u59c6\"\n",
       "                ],\n",
       "                [\n",
       "                    4.8,\n",
       "                    2.5,\n",
       "                    18.1,\n",
       "                    \"\\u5b89\\u5fb7\\u9c81-\\u5a01\\u91d1\\u65af\"\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"formatter\": function(params){return params.value[3];}\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"name\": \"\\u540e\\u536b\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    6.6,\n",
       "                    7.5,\n",
       "                    36.1,\n",
       "                    \"\\u8a79\\u59c6\\u65af-\\u54c8\\u767b\"\n",
       "                ],\n",
       "                [\n",
       "                    5.3,\n",
       "                    5.2,\n",
       "                    27.3,\n",
       "                    \"\\u65af\\u8482\\u82ac-\\u5e93\\u91cc\"\n",
       "                ],\n",
       "                [\n",
       "                    4.1,\n",
       "                    6.8,\n",
       "                    26.6,\n",
       "                    \"\\u5fb7\\u6587-\\u5e03\\u514b\"\n",
       "                ],\n",
       "                [\n",
       "                    4.6,\n",
       "                    6.9,\n",
       "                    25.8,\n",
       "                    \"\\u8fbe\\u7c73\\u5b89-\\u5229\\u62c9\\u5fb7\"\n",
       "                ],\n",
       "                [\n",
       "                    4.4,\n",
       "                    5.9,\n",
       "                    25.6,\n",
       "                    \"\\u80af\\u5df4-\\u6c83\\u514b\"\n",
       "                ],\n",
       "                [\n",
       "                    5.0,\n",
       "                    5.5,\n",
       "                    25.6,\n",
       "                    \"\\u5e03\\u62c9\\u5fb7\\u5229-\\u6bd4\\u5c14\"\n",
       "                ],\n",
       "                [\n",
       "                    5.0,\n",
       "                    6.9,\n",
       "                    23.8,\n",
       "                    \"\\u51ef\\u91cc-\\u6b27\\u6587\"\n",
       "                ],\n",
       "                [\n",
       "                    4.1,\n",
       "                    4.2,\n",
       "                    23.8,\n",
       "                    \"\\u591a\\u8bfa\\u4e07-\\u7c73\\u5207\\u5c14\"\n",
       "                ],\n",
       "                [\n",
       "                    4.7,\n",
       "                    4.5,\n",
       "                    23.7,\n",
       "                    \"\\u624e\\u514b-\\u62c9\\u6587\"\n",
       "                ],\n",
       "                [\n",
       "                    11.1,\n",
       "                    10.7,\n",
       "                    22.9,\n",
       "                    \"\\u62c9\\u585e\\u5c14-\\u5a01\\u65af\\u5e03\\u9c81\\u514b\"\n",
       "                ],\n",
       "                [\n",
       "                    3.8,\n",
       "                    2.4,\n",
       "                    21.5,\n",
       "                    \"\\u514b\\u83b1-\\u6c64\\u666e\\u68ee\"\n",
       "                ],\n",
       "                [\n",
       "                    6.0,\n",
       "                    6.2,\n",
       "                    21.2,\n",
       "                    \"\\u5fb7\\u739b\\u5c14-\\u5fb7\\u7f57\\u8d5e\"\n",
       "                ],\n",
       "                [\n",
       "                    7.8,\n",
       "                    6.0,\n",
       "                    21.2,\n",
       "                    \"\\u5362\\u5361-\\u4e1c\\u5951\\u5947\"\n",
       "                ],\n",
       "                [\n",
       "                    5.0,\n",
       "                    7.7,\n",
       "                    21.2,\n",
       "                    \"\\u6731-\\u970d\\u52d2\\u8fea\"\n",
       "                ],\n",
       "                [\n",
       "                    3.9,\n",
       "                    7.0,\n",
       "                    21.1,\n",
       "                    \"\\u5fb7\\u5b89\\u5409\\u6d1b-\\u62c9\\u585e\\u5c14\"\n",
       "                ],\n",
       "                [\n",
       "                    3.4,\n",
       "                    6.4,\n",
       "                    21.1,\n",
       "                    \"\\u8fc8\\u514b-\\u5eb7\\u5229\"\n",
       "                ],\n",
       "                [\n",
       "                    4.0,\n",
       "                    3.0,\n",
       "                    21.0,\n",
       "                    \"C.J.\\u8fc8\\u514b\\u9c81\\u59c6\"\n",
       "                ],\n",
       "                [\n",
       "                    3.6,\n",
       "                    8.7,\n",
       "                    20.7,\n",
       "                    \"\\u7ea6\\u7ff0-\\u6c83\\u5c14\"\n",
       "                ],\n",
       "                [\n",
       "                    5.0,\n",
       "                    2.5,\n",
       "                    20.7,\n",
       "                    \"\\u5df4\\u8fea-\\u5e0c\\u5c14\\u5fb7\"\n",
       "                ],\n",
       "                [\n",
       "                    3.0,\n",
       "                    5.4,\n",
       "                    20.0,\n",
       "                    \"\\u8def\\u6613\\u65af-\\u5a01\\u5ec9\\u59c6\\u65af\"\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"formatter\": function(params){return params.value[3];}\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u524d\\u950b\",\n",
       "                \"\\u540e\\u536b\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u524d\\u950b\": true,\n",
       "                \"\\u540e\\u536b\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"type\": \"value\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                6.6,\n",
       "                5.3,\n",
       "                4.1,\n",
       "                4.6,\n",
       "                4.4,\n",
       "                5.0,\n",
       "                5.0,\n",
       "                4.1,\n",
       "                4.7,\n",
       "                11.1,\n",
       "                3.8,\n",
       "                6.0,\n",
       "                7.8,\n",
       "                5.0,\n",
       "                3.9,\n",
       "                3.4,\n",
       "                4.0,\n",
       "                3.6,\n",
       "                5.0,\n",
       "                3.0\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"NBA\\u7403\\u5458\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 18.1,\n",
       "        \"max\": 36.1,\n",
       "        \"inRange\": {\n",
       "            \"symbolSize\": [\n",
       "                20,\n",
       "                50\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"inverse\": false,\n",
       "        \"splitNumber\": 5,\n",
       "        \"dimension\": 2,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true,\n",
       "        \"itemWidth\": 20,\n",
       "        \"itemHeight\": 140,\n",
       "        \"borderWidth\": 0\n",
       "    }\n",
       "};\n",
       "                chart_d4e7e1da74f048079b897a1143a11410.setOption(option_d4e7e1da74f048079b897a1143a11410);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x20791a829a0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#实验六\n",
    "import pandas as pd\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Page, Scatter\n",
    "from pyecharts.commons.utils import JsCode\n",
    "from pyecharts.globals import CurrentConfig\n",
    "\n",
    "\n",
    "df = pd.read_csv(r\"C:\\Users\\dell\\Desktop\\实验 四、五、六\\nba.csv\")\n",
    "\n",
    "positions = ['前锋', '后卫']\n",
    "player_df = [df[df['位置'] == pos].head(20) for pos in positions]\n",
    "\n",
    "max_score, min_score = pd.concat(player_df)['得分'].describe()[['max','min']]\n",
    "\n",
    "s = (\n",
    "     Scatter()\n",
    "        .set_global_opts(\n",
    "            title_opts=opts.TitleOpts(title=\"NBA球员\"),\n",
    "            xaxis_opts=opts.AxisOpts(type_=\"value\"),\n",
    "            visualmap_opts=opts.VisualMapOpts(\n",
    "                type_=\"size\", max_=max_score, min_=min_score, dimension=2\n",
    "            )\n",
    "        )\n",
    "     )\n",
    "\n",
    "for players in player_df:\n",
    "    data = [ list(x)[1:] for x in  players[['篮板','助攻','得分','球员']].to_records() ]\n",
    "    s.add_xaxis(eval(repr([x[0] for x in data])))\n",
    "    s.add_yaxis(players.iloc[0]['位置'], \n",
    "                eval(repr([x[1:] for x in data])),\n",
    "                label_opts=opts.LabelOpts(\n",
    "                        formatter=JsCode(\n",
    "                                \"function(params){return params.value[3];}\"\n",
    "                                )\n",
    "                        ),\n",
    "                )\n",
    "\n",
    "s.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
